﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ubcon="clr-namespace:UBConDemo"
                    xmlns:ccontrols="clr-namespace:UBConDemo.CustomControls"
                    xmlns:effect="clr-namespace:UBCon.Resources.Effects;assembly=UBCon.Resources">

    
    <Style x:Key="{ComponentResourceKey ResourceId=GroupHeaderStyle, TypeInTargetAssembly={x:Type ubcon:ResourceManager}}"
           TargetType="{x:Type ccontrols:UbConItem}">
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="VerticalAlignment" Value="Bottom" />
        <Setter Property="TextBlock.Foreground" Value="{DynamicResource ResourceKey={ComponentResourceKey ResourceId=GroupHeaderBrush, TypeInTargetAssembly={x:Type ubcon:ResourceManager}}}"/>
        <Setter Property="TextBlock.FontSize" Value="24"/>
        <Setter Property="MinHeight" Value="0"/>
        <Setter Property="MinWidth" Value="0"/>
        <Setter Property="Margin" Value="2"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="IsEnabled" Value="{Binding Path=DataContext.IsEnabled, RelativeSource={RelativeSource Mode=Self}, Mode=TwoWay}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ccontrols:UbConItem}">
                    <ContentPresenter ContentSource="Content"
                                      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                      VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="TextBlock.Foreground" Value="{DynamicResource ResourceKey={ComponentResourceKey ResourceId=GroupHeaderMouseOverBrush, TypeInTargetAssembly={x:Type ubcon:ResourceManager}}}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Effect">
                    <Setter.Value>
                        <effect:GrayScaleEffect DesaturationFactor="0.0" />
                    </Setter.Value>
                </Setter>
                <Setter Property="TextBlock.Foreground" Value="{DynamicResource ResourceKey={ComponentResourceKey ResourceId=LightGrayBrush, TypeInTargetAssembly={x:Type ubcon:ResourceManager}}}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type ccontrols:UbConItem}"
           x:Key="{ComponentResourceKey ResourceId=ItemContentStyle, TypeInTargetAssembly={x:Type ubcon:ResourceManager}}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="IsEnabled" Value="{Binding Path=DataContext.IsEnabled, RelativeSource={RelativeSource Mode=Self}, Mode=TwoWay}"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Effect">
                    <Setter.Value>
                        <effect:GrayScaleEffect DesaturationFactor="0.0" />
                    </Setter.Value>
                </Setter>
                <Setter Property="TextBlock.Foreground" Value="{DynamicResource ResourceKey={ComponentResourceKey ResourceId=LightGrayBrush, TypeInTargetAssembly={x:Type ubcon:ResourceManager}}}" />
            </Trigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>